package com.xiaojiang.dto;

import com.xiaojiang.entity.AccessType;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * 功能：
 * 作者：小江
 * 日期：2024年10月26日
 */
@Data
public class QueryPersonRecordsDto {
    private Integer personRecordId;
    private String householderName;
    private LocalDateTime accessTime;
    private AccessType accessType;
    private  Integer householderId;

    private Integer currentPage;
    private Integer pageSize;
    private Integer startIndex;

    public QueryPersonRecordsDto() {
        this.currentPage = 1; // 默认第一页
        this.pageSize = 8;  // 默认每页10条记录
    }

    public Integer getStartIndex() {
        if (this.currentPage == null || this.pageSize == null) {
            throw new IllegalArgumentException("currentPage or pageSize cannot be null");
        }
        return (this.currentPage - 1) * this.pageSize;
    }

}
